from django.urls import path
from . import views
from django.contrib.auth import views as auth_views

urlpatterns = [
    path('', views.index, name='index'),
    path('accounts/login/', auth_views.LoginView.as_view(template_name='registration/login.html'), name='login'),
    path('accounts/logout/', auth_views.LogoutView.as_view(), name='logout'),
    path('mybooks/', views.LoanedBooksByUserListView.as_view(), name='my-borrowed'),
    # 续借图书
    path('book/<int:pk>/renew/', views.renew_book_librarian, name='renew-book-librarian'),
    # 作者增删改
    path('author/create/', views.AuthorCreateView.as_view(), name='author-create'),
    path('author/<int:pk>/update/', views.AuthorUpdateView.as_view(), name='author-update'),
    path('author/<int:pk>/delete/', views.AuthorDeleteView.as_view(), name='author-delete'),
    # 作者列表
    path('authors/', views.AuthorListView.as_view(), name='authors'),
    # 作者详细视图
    path('author/<int:pk>/', views.AuthorDetailView.as_view(), name='author-detail'),
    # 所有借出图书（仅图书馆员可见）
    path('borrowed/', views.AllBorrowedBooksListView.as_view(), name='all-borrowed'),
    # 图书搜索
    path('search/', views.book_search, name='book-search'),
    # 图书详情
    path('book/<int:pk>/', views.book_detail, name='book-detail'),
    # 用户借阅历史
    path('myhistory/', views.LoanHistoryView.as_view(), name='my-loan-history'),
    path('book/create/', views.BookCreateView.as_view(), name='book-create'),
    path('book/<int:pk>/update/', views.BookUpdateView.as_view(), name='book-update'),
    path('book/<int:pk>/delete/', views.BookDeleteView.as_view(), name='book-delete'),
    path('review/like/', views.like_review, name='like-review'),
    path('review/reply/', views.reply_review, name='reply-review'),
    path('book/favorite/', views.toggle_favorite, name='toggle-favorite'),
    path('book/like/', views.toggle_like, name='toggle-like'),
    path('ai/ask_author/', views.ai_ask_author, name='ai-ask-author'),
    path('ai/book_summary/', views.ai_book_summary, name='ai-book-summary'),
] 